import requests from "./ajax";

// const baseURL = "https://yfjx.online:443";

// 获取用户信息
export const reqGetUsers = (params) => {
  return requests({
    url: `/Admin/getAllUser`,
    method: "get",
    params,
    headers: { "Content-Type": "application/x-www-form-urlencoded" },
  });
};
// 添加用户
// export const reqAddUsers = (data) =>
//   requests({ url: `/admin/add_user`, data, method: "post" });

// 搜索用户
export const reqSearchUser = (data) =>
  requests({
    url: `/Admin/get_user/condition`,
    data,
    headers: { "Content-Type": "application/x-www-form-urlencoded" },
    method: "post",
  });
// 修改身份
export const reqChangeIdentity = (params) =>
  requests({
    url: `/Admin/switch/userType`,
    params,
    method: "get",
  });
// 删除用户
export const reqdeleteUser = (data) =>
  requests({
    url: `/Admin/updateDel`,
    data,
    // headers: { "Content-Type": "application/x-www-form-urlencoded" },
    method: "post",
  });
// // 修改手机号码
// export const reqChangePhone = (data) =>
//   requests({ url: `/admin/update_user_phone`, data, method: "post" });
// 修改密码
export const reqUpdatePassword = (data) =>
  requests({ url: `/user/update_password`, data, method: "post" });
// 修改用户状态
export const reqChangeStatus = (data) =>
  requests({
    url: `/Admin/updateStatus`,
    data,
    method: "post",
  });
// 获取手机验证码
export const reqGetPhoneCode = (data) =>
  requests({
    url: `/sms/send_sms`,
    data,
    method: "post",
    headers: { "Content-Type": "application/x-www-form-urlencoded" },
  });
// 上传头像
export const reqUploadImage = (data) =>
  requests({
    url: `/image/upload`,
    data,
    method: "post",
    headers: { "Content-Type": "multipart/form-data" },
  });
//更改头像
export const reqChangeUserImage = (data) =>
  requests({
    url: `/user/update_avatar`,
    data,
    method: "post",
    headers: { "Content-Type": "application/x-www-form-urlencoded" },
  });

//获取排班信息
export const reqWorkList = (data) =>
  requests({
    url: `${baseURL}/work_schedule/get_work_schedule`,
    data,
    method: "post",
    headers: { "Content-Type": "application/x-www-form-urlencoded" },
  });

//添加排班信息
export const reqAddWorkList = (data) =>
  requests({
    url: `${baseURL}/work_schedule/add_work_schedule`,
    data,
    method: "post",
  });

//获取未排班人员
export const reqNotArrangeUsers = () =>
  requests({
    url: `${baseURL}/work_schedule/get_not_scheduled`,
    method: "get",
    headers: { "Content-Type": "application/x-www-form-urlencoded" },
  });
//删除排班人员
export const reqDeleteArrangeUser = (data) =>
  requests({
    url: `${baseURL}/work_schedule/delete_work_schedule`,
    method: "delete",
    data,
    headers: { "Content-Type": "application/x-www-form-urlencoded" },
  });
//更新排班人员
export const reqUpdateArrangeUser = (data) =>
  requests({
    url: `${baseURL}/work_schedule/update_work_schedule`,
    method: "post",
    data,
  });
//搜索排班人员
export const reqSearchArrangeUser = (data) =>
  requests({
    url: `${baseURL}/work_schedule/get_work_schedule/condition`,
    method: "post",
    data,
    headers: { "Content-Type": "application/x-www-form-urlencoded" },
  });
//下载模板
export const reqDownload = () =>
  requests({
    url: `${baseURL}/admin/excel/down_load`,
    method: "get",
    headers: { "Content-Type": "application/x-www-form-urlencoded" },
    responseType: "blob",
  });
//批量导入
export const reqImportUser = (data) =>
  requests({
    url: `${baseURL}/admin/excel/import_user`,
    method: "post",
    data,
    headers: { "Content-Type": "multipart/form-data" },
  });
